package com.niuke;

import java.util.*;

/**
 * @ClassName : HJ27
 * @Author : kele
 * @Date: 2023/4/2 13:10
 * @Description :
 */
public class HJ27 {
    public static ArrayList<String> solution(List<String> strs, String target) {

        ArrayList<String> res = new ArrayList<>();
        Collections.sort(strs);
        char[] ch_target = target.toCharArray();
        Arrays.sort(ch_target);
        String str_target = String.valueOf(ch_target);


        for (int i = 0; i < strs.size(); i++) {
            char[] ch = strs.get(i).toCharArray();
            Arrays.sort(ch);
            String st = String.valueOf(ch);

            if (str_target.equals(st) && !target.equals(strs.get(i))) {
                res.add(strs.get(i));
            }

        }
        return res;


    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int num = in.nextInt();
            List<String> datas = new ArrayList();
            for (int i = 0; i < num; i++) {
                datas.add(in.next());
            }
            String x = in.next();
            int index = in.nextInt();
            ArrayList<String> res = solution(datas, x);
//            System.out.println(res);
            System.out.println(res.size());
            if(index <= res.size() && index >= 1){
                System.out.println(res.get(index - 1));
            }
        }
    }
}
